using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using BoardController.ViewModels;
using BoardController.Views;

namespace BoardController
{
    public class App : Application
    {
        public override void Initialize()
        {
            AvaloniaXamlLoader.Load(this);
            try
            {
                IResourceDictionary resourceDictionary = this.Resources;
                if (!resourceDictionary.ContainsKey("ChineseFontFamily"))
                {
                    return;
                }
                Uri uri = new Uri(@"avares://BoardController/Assets/Fonts/msyh.ttc");
                resourceDictionary["ChineseFontFamily"] = new FontFamily(uri, "Microsoft YaHei"); ;

              
            }
            catch (Exception e)
            {
              
            }
           


           
        }

        public override void OnFrameworkInitializationCompleted()
        {
            if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
            {
                desktop.MainWindow = new IndexWindow();
            }

            base.OnFrameworkInitializationCompleted();
        }
    }
}
